<template>
	<view class="p-20-0">
		<view class="p20 bg-white">
			<view class="f38 tc" style="margin-bottom: 340rpx;">
				{{ $t("gent.index.text22") }}{{getLocalizedValue(detail,"grade_name") }}
			</view>
			<button class="btn-red" @click="submit">{{ $t("agent.index.text23") }}</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				code: "",
				detail: {}
			}
		},
		onLoad(options) {
			this.code = options.code
			this.getDetail()
		},
		methods: {
			async getDetail() {
				this._post("user.agent/get_grade_update_detail", {
					code: this.code
				}, res => {
					console.log(res)
					this.detail = res.data.cahce
				})
			},
			submit() {
				this._post("user.agent/help_user_grade_update", {
					code: this.code
				}, res => {
					if (res.code != 1) {
						this.showError(res.msg)
						return
					}

					this.showSuccess(self.$t("app.success"), () => {
						uni.reLaunch({
							url: "/pages/index/index"
						})
					})

					console.log(res)
				})
			}
		}
	}
</script>

<style>

</style>